//
//  SearchCell.m
//  B段项目
//
//  Created by dllo on 15/9/25.
//  Copyright (c) 2015年 昶博. All rights reserved.
//

#import "SearchCell.h"
#import "SearchBarModel.h"
#import "PrefixHeader.pch"

@implementation SearchCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.titleWeb= [[UIWebView alloc] init];
        [self.contentView addSubview:self.titleWeb];
        self.titleWeb.userInteractionEnabled = NO;
        
        self.typeLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.typeLabel];
        self.typeLabel.font = [UIFont systemFontOfSize:14];
        
    }
    
    return self;
    
}

//布局子视图
- (void)layoutSubviews
{
    [super layoutSubviews];
    //新闻标题
    self.titleWeb.frame = CGRectMake(ScreenWidth * 10 / 375, ScreenHeight * 5 / 667, ScreenWidth * 370 / 375, ScreenHeight * 35 / 667);
    self.typeLabel.frame = CGRectMake(ScreenWidth * 19 / 375, ScreenHeight * 42 / 667, ScreenWidth * 70 / 375, ScreenHeight * 20 / 667);
    
}

- (void)setSearchBarModel:(SearchBarModel *)searchBarModel
{
    [self.titleWeb loadHTMLString:searchBarModel.newsTitle baseURL:nil];
    
    self.webLink = searchBarModel.newsLink;
    self.typeLabel.text = searchBarModel.newsCategory;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
